package bean;

import essenceClasses.User;
import helper.UserHelper;

/**
 * Created by User on 09.06.14.
 */
public class UserBean implements java.io.Serializable {
    private String login;
    private String pass;
    private String fullName;
    private int access;

    public UserBean() {
    }
    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public int getAccess() {
        return access;
    }

    public void setAccess(int access) {
        this.access = access;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getLogin() {

        return login;
    }

    public String getPass() {
        return pass;
    }

    public void setAuth(boolean bool) {
        User user = new UserHelper().Login(login, pass);
        if (user != null) {
            this.access = user.getAccess();
        } else {
            this.access = -1;
        }
    }

    public void setCreateUser(boolean bool) {
        User user = new UserHelper().AddUser(login, pass, fullName, access);
        if (user == null) {
            access = -1;
        }
    }
}
